﻿using System;
using System.ComponentModel.DataAnnotations;
using Ewk.MachineLearning.Classification.Interfaces;

namespace Ewk.MachineLearning.Persistance.Domain
{
    /// <summary>
    /// Represents a link between a <see cref="Message"/> and a <see cref="Word"/>.
    /// </summary>
    public class WordInMessageLink :
        Entity,
        IFeatureLink
    {
        /// <summary>
        /// The identifier of the <see cref="Word"/> to which this <see cref="WordInMessageLink"/> links a <see cref="Message"/>.
        /// </summary>
        [Required]
        public Guid WordId { get; set; }

        /// <summary>
        /// The number of times the <see cref="Word"/> in this <see cref="WordInMessageLink"/> links to a <see cref="Message"/>.
        /// </summary>
        public long Occurrence { get; set; }

        #region Implementation of IEntityLink

        /// <summary>
        /// The classification entity that is linked.
        /// </summary>
        Guid IFeatureLink.FeatureId
        {
            get { return WordId; }
            set { WordId = value; }
        }

        #endregion
    }
}